package com.jming.common.rabbit.schedule;

import com.jming.common.rabbit.constant.MqConst;
import com.jming.common.rabbit.service.RabbitService;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author jming
 * @version 0.0.1
 * @date 2021/05/17
 */
@Component
@EnableScheduling
public class ScheduledTask {

    @Resource
    private RabbitService rabbitService;

    /**
     * 每天8点执行方法，就医提醒
     * cron表达式，设置执行时间（0 0 8 * * ？）
     * 0/30 * * * * ?
     * @param
     * @Author jming
     * @Date 2021/5/17
     * @return void
     */
    @Scheduled(cron = "0 0 8 * * ？")
    public void taskPatient() {
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8, "");

    }

}
